/**
 * @author Tsai, Min Che
 */
(function($) {
	$.workbar = {
		addWork: function(options) {
			var workbar = $('#workbar #works');
			workbar.append('<div id="workbar_' + options.id + '"><span><img src="' + options.icon + '" />' + options.text + '</span></div>');
			workbar.find('div:last').addClass('selected').click(options.click).click($.workbar.setWorking(options.id)).hover(
				function() {
					$(this).addClass('hover');
				},
				function() {
					$(this).removeClass('hover');
				}
			);
		},
		setWorking: function(id) {
			$('#workbar #works').find('div').removeClass('selected');
			$('#workbar_' + id).addClass('selected');
		},
		removeWork: function(id) {
			$('#workbar_' + id).unbind('click').remove();
		}
	}
})(jQuery);